home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
DDJMAG
/
DDJ9005.ZIP
/
AYERS.ZIP
/
RNDMNMBR.CLS
< prev
Wrap
Text File
|
1990-02-20
|
453b
|
28 lines
Object subclass: #RandomNumber
instanceVariableNames: ''
classVariableNames:
'Seed '
poolDictionaries: '' !
!RandomNumber class methods !
from:min to:max
^(self new \\ (max - min + 1)) + min.!
new
|n|
Seed isNil ifTrue:[self reset].
n := Seed.
Seed := (Seed * 263 + 30011) bitAnd:16r7FFF.
^n.!
randomize
Seed := Time millisecondClockValue bitAnd:16r7FFF.!
reset
Seed := 0.! !
!RandomNumber methods ! !